package pl.enigmatic.parser.string.pl.edu.enigma.time;

import pl.enigmatic.time.TimeSpan;
import pl.enigmatic.parser.string.Converter;
import pl.enigmatic.parser.string.custom.TimeSecondsDoubleConverter;


public class TimeSpanConverter extends Converter<TimeSpan> {

	private final TimeSecondsDoubleConverter timeConverter = new TimeSecondsDoubleConverter();

	@Override
	public TimeSpan convert(final String value) {
		return new TimeSpan(timeConverter.convert(value));
	}

	@Override
	public String convertBack(final TimeSpan value) {
		return timeConverter.convertBack(value.getTotalSeconds());
	}

}
